package structure.composite.transparent;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 * 士兵
 */

public class Soldiers extends Armys {

    private List<Armys> list = new LinkedList<>();

    public Soldiers() {
        super("士兵");
    }


    public void add(Armys armys) {
        System.out.println("增加了一个士兵");
        list.add(armys);
    }


    public void remove(Armys armys) {
        list.remove(armys);
    }

    @Override
    public void display() {
        System.out.println("Soldiers{" +
                "name='" + name + '\'' + "list=" + Arrays.deepToString(new List[]{list}) +
                '}');
    }

}
